﻿using System.Reflection;
using System.Web.Http.ExceptionHandling;
using log4net;

namespace Syufy.BINLookup.Web.Helpers
{
    internal class ApiExceptionLogger : ExceptionLogger
    {
        #region Logging
        /// <summary>
        /// Access to the log4Net logging object
        /// </summary>
        protected static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        #endregion

        public override void Log(ExceptionLoggerContext context)
        {
            log.Error(string.Format("Unhandled exception thrown in {0} for request {1}: {2}", context.Request.Method, context.Request.RequestUri, context.Exception));
        }
    }
}